interface IFile {
  id: string;
  ext: string;
  src: string;
  title: string;
  subtitle?: string;
}

interface IAttachment {
  id: string;
  date: string;
  number: string;
  fileList: Array<IFile>;
}

interface IReportProblemItem {
  id: string;
  serialNumber: string;
  itemDescription: string;
  symptoms: string;
}

interface IAttachmentFormItem {
  id: string;
  src: string;
}
// Projects
interface IProject {
  id: string;
  number: string;
  customerName: string;
  contactPerson: string;
  updateTime: string;
  updateDate: string;
  progress: number;
  projectSum: number;
  jobsSum: number;
  tasksSum: number;
  projectList: IProjectItem[];
}

interface IProjectItem extends IProjectForm {
  jobSum: number;
  tasksSum: number;
}

interface IProjectForm {
  id?: string;
  company: ICompany;
  contactPerson: string;
  tel: string;
  address: string;
  projectName: string;
  priority: string;
  projectType: string;
  projectDescription: string;
  projectLocation: string;
  serviceProvider: string;
  startDate: string;
  endDate: string;
  partnerList: Array<IPartner>;
  userRight: IUserRight;
}

interface ICompany {
  id: string;
  name: string;
  code: string;
}

interface IUserRight {
  commonUserRightList: Array<ICommonUserRight>;
  advancedUserRightList: Array<IAdvancedUserRight>;
}

interface ICommonUserRight {
  id?: string;
  type: string;
  userName: string;
  right: string[];
}

interface IAdvancedUserRight {
  id?: string;
  userId: string;
  viewUserId: string;
  right: string[];
}

interface IPartner extends ISupplier, IMember {
  id: string;
}

interface IContact {
  userID: string;
  userName: string;
  tel: string;
  location: string;
}

interface IMember extends Omit<IContact, "userName"> {
  memberName: string;
}

interface ISupplier {
  contractor: string;
  contactCode: string;
  companyName: string;
}

// Jobs
interface IJobs {
  id: string;
  number: string;
  customerName: string;
  updateTime: string;
  updateDate: string;
  progress: number;
  jobsSum: number;
  tasksSum: number;
  jobList: IJobItem[];
}

interface IJobItem {
  id: string;
  jobCate: string;
  customerName: string;
  progress: number;
  number: string;
  status: string;
  priority: string;
  startDate: string;
  endDate: string;
  tel: string;
  jobName: string;
  contactPerson: string;
  jobDescription: string;
  projectLocation: string;
  remarks: string;
  tasksSum: number;
  assignTo: string;
  reportProblemList: Array<IReportProblemItem>;
  attachmentList: Array<IAttachment>;
}
interface IJobForm {
  id?: string;
  customerName: string;
  customerCode: string;
  projectName: string;
  contactPerson: string;
  tel: string;
  address: string;
  //job details
  jobName: string;
  jobStatus?: string;
  priority: string;
  jobCate: string;
  totalJob: string;
  jobDescription: string;
  projectLocation: string;
  serviceProvider: string;
  team: string;
  assignTo: string;
  startTime: string;
  endTime: string;
  remarks: string;
  //job attachment
  attachmentList: IAttachmentFormItem[];
  //job report problem
  reportProblemList: IReportProblemItem[];
}

// tasks
interface ITasks {
  id: string;
  number: string;
  customerName: string;
  taskNumber: string;
  jobNumber: string;
  updateTime: string;
  updateDate: string;
  progress: number;
  tasksSum: number;
  activitiesSum: number;
  taskList: ITaskItem[];
}

interface ITaskItem {
  id: string;
  taskNumber: string;
  taskName: string;
  status: string;
  priority: string;
  startDate: string;
  endDate: string;
  info: string;
  activitiesSum: number;
  reportProblemList: ITaskReportProblem[];
  activityLog: activity[];
  attachmentList: IAttachment[];
}

interface ITaskReportProblem extends IReportProblemItem {
  problemType: string;
  solution: string;
}

interface ITasksForm {
  id?: string;
  customerName: string;
  jobName: string;
  jobNumber: string;
  finishDate: string;
  assignTo: string;
  // Task Details
  taskNumber: string;
  taskName: string;
  taskDescription: string;
  taskOwner: string;
  startTime: string;
  endTime: string;
  // Attachment
  attachment: IAttachmentFormItem[];
  // Report Problem
  reportProblem: ITaskReportProblem[];
}

interface activity {
  id: string;
  date: string;
  user: string;
  avatarSrc: string;
  procedure: string;
  place: string;
}

export {
  IProject,
  IProjectItem,
  IProjectForm,
  IPartner,
  ISupplier,
  IMember,
  IContact,
  IJobs,
  IJobItem,
  IJobForm,
  IAttachment,
  IFile,
  ITasksForm,
  ITasks,
  ITaskItem,
};
